<?php

require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/appconf.php');
require_once(dirname(__FILE__) . '/config.php');

class mapi_itrial_game extends Site {

    function setup() {
        $this->run_modes('step1', 'step2');
        $this->start_mode('step1');
        parent::setup();
    }

    function cgiapp_prerun() {
        $this->mapi_object = getModel('MAPI_Base');
        $this->api = $this->param('URL') . 'mapi/itrial/v00.90';
        parent::cgiapp_prerun();
    }

    function action_step1() {
        $h_row_user_action = array(
            'button' => array(
                array(
                    'text' => 'Go to Step2',
                    'description' => "",
                    'color' => '0,255,0',
                    'action' => $this->api . '/game.php?action=step2',
                    'type' => 'remote'
                )
            )
            ,
            'message' => "測試數據第一步",
            'debug_tag' => 'confirm_invite',
            'remark' => '',
            'photo_url' => '',
        );


        return $this->mapi_object->to_json(array('user_action' => $h_row_user_action));
    }

    function action_step2() {
        $h_row_user_action = array(
            'button' => array(
                array(
                    'text' => 'Go to Step1',
                    'description' => "",
                    'color' => '0,255,0',
                    'action' => $this->api . '/game.php?action=step1',
                    'type' => 'remote'
                )
            ),
            'message' => "測試數據第一步",
            'debug_tag' => 'confirm_invite',
            'remark' => '',
            'photo_url' => '',
        );


        return $this->mapi_object->to_json(array('user_action' => $h_row_user_action));
    }

}

header("Content-type: text/html; charset=utf-8");
$webapp = new mapi_itrial_game();
$webapp->run();
?>
